import util.DelayRandom;
import util.MouseClick;

import java.awt.*;

public class ActivityMain {
    public static void main(String[] args) throws AWTException, InterruptedException {

        //创建java机器人
        Robot robot = new Robot();

        //延迟5秒后运行
        robot.delay(1000*5);


        //鼠标点击后，松开时间隔
        int press = DelayRandom.createRandom(0.3, 0.36);
        int release = 10*38;

        //模拟人的操作，设置间隔
        int move = DelayRandom.createRandom(0.4, 0.8);
        robot.delay(move);

        for (int i = 0; i < 300*2; i++) {

            // 移动位置
            int x = DelayRandom.createRandom(1.4, 1.44);
            int y = DelayRandom.createRandom(0.69, 0.72);
            System.out.println(x);
            System.out.println(y);

            //移动鼠标
            //x 行；y 列
            robot.mouseMove(x,y);

            if (i % 2 == 0) {

                //画面延迟加载预估时间
                release = DelayRandom.createRandom(6.4, 7.8);
                System.out.println("============游戏开始============" + release);
                MouseClick.click(robot, press, release);

                // 体服
                Thread.sleep(3000);
            }else {
                for (int j = 0; j < 2; j++) {
                    //3到5秒响应时间
                    release = DelayRandom.createRandom(1.9, 2.9);
                    System.out.println("============结算："+release);
                    MouseClick.click(robot,press,move);


                    // 体服
                    Thread.sleep(900);
                }
            }
        }
    }
}
